<?php
/**
 * 向自定义进程发送消息
*/

namespace houze\process;
use houze\SingleCase;

class SubProcess
{
    use SingleCase;

    /**
     * 子进程实例表
    */
    private static $_list = [];

    /**
     * 向子进程传递数据
    */
    public static function write($process_key, $mixed) {
        if (isset(self::$_list[$process_key])) {
            return self::$_list[$process_key]->write($mixed);
        }
        return false;
    }

    /**
     * 注册子进程实例
    */
    public static function register($process_key, $process) {
        self::$_list[$process_key] = $process;
    }
}